package com.vue3.blog.service.impl;

import com.vue3.blog.service.IArticleService;
import com.vue3.blog.service.ICommentService;
import com.vue3.blog.service.IStatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Mr.小朱同学
 * @version 1.0.0
 * @date 2025/6/25 12:08
 * @description 统计服务实现类
 */
@Service
public class StatService implements IStatService {
    @Resource
    private IArticleService articleService;
    @Resource
    private ICommentService commentService;

    /**
     * 评论数、文章数
     */
    @Override
    public Map<String, Object> getArticleCommentInfoStat() {
        // 获取文章数
        Long articleCount = articleService.getArticleCount(1);
        // 获取评论数
        Long commentCount = commentService.getCommentCount();
        Map<String, Object> map = new HashMap<>();
        map.put("articleCount", articleCount);
        map.put("commentCount", commentCount);
        return map;
    }
}